#include "ParticleSignalLineBoth.h"

#include "ParticleContext.h"
#include "DescriptorParticle.h"

//include "StreamBinary.h"

using namespace ParticleEngine;

const DescriptorParticle ParticleSignalLineBoth::Descriptor
(
"SignalLineBoth",
[](ParticleContext& NewContext) { return new ParticleSignalLineBoth(NewContext); }
);

ParticleSignalLineBoth::ParticleSignalLineBoth(ParticleContext& NewContext) :
ParticleBase(NewContext, &ParticleSignalLineBoth::Descriptor),
PropertyAdhesions(0.15f),
Heat(0.5f)
{
	this->Adhesions = dynamic_cast<PropertyAdhesions*>(this);
	this->Adhesions->ParticleCast = dynamic_cast<ParticleBase*>(this);
}
ParticleSignalLineBoth::~ParticleSignalLineBoth()
{
}

void ParticleSignalLineBoth::Sole()//einzelne aktualisierzung
{
	this->SoleStandard();

	this->Heat.Sole();
	this->Signal0.Sole();
	this->Signal1.Sole();
}
void ParticleSignalLineBoth::InteractionIndividual(ParticleBase*const Other, Vec<2, float>& Space, const float& DistanceSquared)
{
	this->InteractionKinetics(Other, Space, DistanceSquared);

	this->Heat.Interaction(Other->HasHeat());
	this->Signal0.Interaction(Other->HasSignal0());
	this->Signal1.Interaction(Other->HasSignal1());
}

ColorRGBA<unsigned char> ParticleSignalLineBoth::GetColor()
{
	if (Signal0.Current == SignalStatus::Active || Signal1.Current == SignalStatus::Active)
		return ColorRGBA<unsigned char>(220, 220, 50, 255);
	else
		return ColorRGBA<unsigned char>(50, 50, 20, 255);
}

void ParticleSignalLineBoth::SaveIndividual(std::ofstream& Strm)
{
	Heat.Save(Strm);
	Signal0.Save(Strm);
}
void ParticleSignalLineBoth::LoadIndividual(std::ifstream& Strm)
{
	Heat.Load(Strm);
	Signal0.Load(Strm);
}


